<?php if (!defined('THINK_PATH')) exit();?><style>
    #wtxx label,#wtcl label,#cxxx label,#wtyz label,{
        display:block;
        padding:5px 0 5px 10px;
    }
    #wtxx div,#wtcl div,#cxxx div,#wtyz div{
        padding: 5px 0 3px 15px;
    }
    .zlpic{
        width:230px;
        padding: 5px;
    }
</style>
<div  class="easyui-layout" data-options="fit:true">
    <div data-options="region:'north',title:'',split:false,border:false" style="height:38px;background-color: #EBF2FF;">
        <style>
#finaBox{
	display: none;

}
	.finaSeDiv{
		float:left;
		padding:10px 0 5px 10px;
		width:200px;
	}
	.finaSeDiv2{
		float:left;
		padding:10px 0 5px 10px;
		/*width:200px;*/
	}
	.finaSeDiv label,.finaSeDiv2 label{
		width:53px;
		float: left;
	}
	.table-btn-separator {
    float: center;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #fff;
  /*  width: 1200px;*/
}
    #zl_tool{
        float: left;

    }
</style>

<div id="zl_tool">

<table style="float: left;">
<tr  style="float: left;">
	<td>
		<?php if(authCheck1('Home/Zhijia/showadd')): ?><a href="#" id= "aaa1" class="easyui-linkbutton"  onclick='show_add_zj()' data-options="iconCls:'icon-standard-folder-page',plain:true">添加</a><?php endif; ?>
	    <?php if(authCheck1('Home/Zhijia/del')): ?><a href="#" class="easyui-linkbutton"  onclick='delezj()' data-options="iconCls:'icon-standard-page-white-delete',plain:true">删除</a><?php endif; ?>
	    <?php if(authCheck1('Home/Zhijia/edit')): ?><a href="#" class="easyui-linkbutton"  onclick='show_edit_zj()' data-options="iconCls:'icon-standard-application-edit',plain:true">编辑</a><?php endif; ?>
	</td>
	<?php if(authCheck1('Home/Zhijia/add,Home/Zhiliang/del,Home/Zhiliang/edit',1,1,'and')): ?><td>
			<div class="datagrid-btn-separator"></div>
		</td><?php endif; ?>


	<td>

	        <a href="#"  class="easyui-linkbutton"   onclick="daochu()" data-options="iconCls:'icon-standard-page-white-excel',plain:true">导出</a>

	</td>
	<td>
    	<div class="datagrid-btn-separator"></div>
	</td>
   	<td>
	  <a href="#" class="easyui-linkbutton"  onclick="reloadzj()" data-options="iconCls:'icon-standard-arrow-refresh',plain:true">刷新</a>
   	</td>
	<td>
	     <div class="datagrid-btn-separator"></div>
	</td>
	<td>
        图号：
        <input id="th_ss"  class="easyui-textbox"
               data-options="iconCls:'',editable:true,required:false,panelHeight:'auto',prompt:'请输入图号'"
               style="width:120px"/>
        名称：
        <input id="mc_ss"  class="easyui-textbox"
               data-options="iconCls:'',editable:true,required:false,panelHeight:'auto',prompt:'请输入名称'"
               style="width:120px"/>

		标签：

        <input id="fl_ss"  class="easyui-textbox"
               data-options="iconCls:'',editable:true,required:false,panelHeight:'auto',prompt:'请输入标签，用,隔开'"
               style="width:120px"/>

       <a href="#" id="finaSearch" class="easyui-linkbutton"  onclick="Search_zj()" data-options="iconCls:'icon-search',plain:true">搜索</a>
 </td>


</tr>



</table>





</div>

<script>
    function show_add_zj() {

        var tab = $('#tab').tabs('getSelected');
        tab.panel('refresh', APP+'/Home/Zhijia/showadd');
    }
    function show_edit_zj(){
        var row = $('#zj_dg').datagrid("getSelected");
        if (row) {


                $("#edit_zj").dialog("open").dialog('setTitle', '&nbsp;&nbsp;编辑支架信息');

                $("#edit_zj_form").form("load", row);

        } else {
            $.messager.alert("请选择", "请选择要删除的项目！", "info");
        }
    }
function Search_zj(){
    $('#zj_dg').datagrid('load',{
        fl:$("#fl_ss").textbox('getText'),

        mc:$("#mc_ss").textbox('getText'),
        th:$("#th_ss").textbox('getText')
    });
    }

    function finSerZhiliangBtn(){
        $('#zl_dg').datagrid('load',{
            finddate:$("#f_creatdates").datebox('getValue'),
            finddatee:$("#f_creatdatee").datebox('getValue')
        });
    }
</script>
    </div>

    <div data-options="region:'west',title:'图纸',split:true" style="width:260px;">
        
    <div  id="wtxxTab" class="easyui-tabs" data-options="fit:true,border:false">

        <div title="数据信息" data-options="fit:true,border:false" style="padding: 5px;">
            <form id="info_form">
                <div>
                    <label >类别:</label>
                    <input class="easyui-textbox" type="text" name="lb" data-options="editable:false"
                           style="width:200px;"/>
                </div>
            <div>
                <label >名称:</label>
                <input class="easyui-textbox" type="text" name="mc" data-options="editable:false"
                       style="width:200px;"/>
            </div>
            <div>
                <label >图号:</label>
                <input class="easyui-textbox" type="text" name="th" data-options="editable:false"
                       style="width:200px;"/>
            </div>
                <div>
                    <label >分类:</label>
                    <input class="easyui-textbox" type="text" name="fl" data-options="editable:false"
                           style="width:200px;"/>
                </div>

            <div>
                <label >说明:</label>
                <input class="easyui-textbox" type="text" name="description" data-options="editable:false,multiline:true"
                       style="width:200px;height:300px;"/>
            </div>


            </form>
        </div>

        <div id="tzshows" title="图纸" data-options="closable:false,border:false" style="">

        </div>
        <div id="zpshows" title="照片" data-options="closable:false,border:false" style="">

        </div>

    </div>
    <script>
        $('#cj_xx').combobox({
            valueField: 'id',
            url: APP+'/Admin/Trem/cjList',
            textField: 'title',
            editable: false,
            onSelect: function (rec) {
                $('#gw_xx').combogrid({
                    panelWidth: 200,
                    idField: 'title',
                    textField: 'title',
                    multiple: true,
                    striped: true,
                    url: APP+'/Admin/Trem/cjList?pid=' + rec.id,
                    columns: [[
                        {field: 'title', title: '名称', width: 120}
                    ]]
                });
                $('#gw_xx').combobox('clear');
            }
        });

    </script>

    </div>
    <div data-options="region:'center',title:''" style="padding:5px;background:#eee;">
        <table id="zj_dg"></table>

    </div>
</div>
<!--工具栏1 -->


<style>
    .uploadpic {
        float: left;
        width: 295px;
        text-align: center;
        height: 165px;
    }

    .uploadpic h3 {
        text-align: left;
        border: 1px solid #95B8E7;
        float: left;
        padding: 4px;
        background-color: #95B8E7;
        color: #FFF;
    }

    .up-content {
        border: 1px solid #95B8E7;
        padding: 4px;
    }

    .w10 {
        float: left;
        width: 10px;
        color: #FFF;
    }

    .items {
        padding: 10px 0 4px 0;
        border-top: solid 1px #D6D4D4;
        display: block;
    }

    #dd div {
        padding-right: 10px;
        padding-bottom: 10px;
    }

    .addItems {
        float: left;
    }

    /*表格样式  */
    .add_table {
        width: 100%;
        border: 1px solid #0e90d2;
    }

    .add_table th {
        width: 80px;
        background-color: #E0ECFF;
        padding: 8px 0 8px 0;
        border-right: solid 1px #95B8E7;
        border-bottom: solid 1px #95B8E7;
    }

    .add_table td {
        border-bottom: solid 1px #95B8E7;
    }

    .add_table tr {
        border: solid 1px #95B8E7;
    }

    .tb_head {
        text-align: center;
        padding: 10px;
        background-color: #E0ECFF;
        font-size: 20px;
        font-weight: bold;
    }

    .inline {
        display: inline;
        padding-right: 5px;
    }

    .row_container {
        padding: 8px 5px 5px 5px;
    }


    .edit_zl_title{
        font-size: 20px;
        color: #0e2d5f;
        text-align: center;
        padding: 10px;
        font-weight: bold;
    }
</style>
<div id="edit_zj" class="easyui-dialog" style="width:800px; height: 250px; padding: 0px; overflow: hidden;" title="编辑支架信息" data-options="iconCls:'icon-standard-folder-page',buttons:'#dlg-chuli',closed:true,resizable:false,modal:true,closable:true">

    <form id="edit_zj_form" action="" enctype="multipart/form-data" method="post" style="padding:10px;">
        <table class="add_table">
            <tr>
                <th>图号/名称</th>
                <td>
                    <div class="row_container" style="background: #FFFEE6;">
                        <div class="inline">
                            <span class="add_label">图号</span>
                            <input id="th_add" class="easyui-textbox" data-options="required:true"
                                   name="th" style="width:200px;"/>

                        </div>

                        <div class="inline">
                            <span class="add_label">名称</span>
                            <input id="mc_add" class="easyui-textbox" data-options="required:true"
                                   name="mc" style="width:200px;"/>
                        </div>


                    </div>
                </td>
            </tr>
            <th>标签</th>
            <td style="background-color:rgba(204, 204, 204, 0.4);">
                <div class="row_container">

                    <div class="panel" style="display: block;">
                        <div class="easyui-panel panel-body panel-body-noheader" style="padding: 5px; width: 100%;"
                             title="">

                            <span class="add_label">分类：</span>
                            <input id="fl_add" class="easyui-textbox" data-options="required:true,prompt:'请输入标签，用,隔开'"
                                   name="fl" style="width:200px;"/>

                            <span class="add_label" style="padding-left:5px;">类别：</span>
                            <select id="lb_add" class="easyui-combobox" name="lb" style="width:200px;" data-options="editable:false,required:true,panelHeight:'auto'">
                                <option value="支架" selected="selected">支架</option>
                                <option value="管路">管路</option>
                                <option value="塑料件">塑料件</option>
                                <option value="卡箍">卡箍</option>

                            </select>

                            <br>
                        </div>
                    </div>
                </div>



            </td>
            </tr>
            <tr>
                <th>说明</th>
                <td>
                    <div class="easyui-panel" style="padding:5px;">
                        <textarea name="description" class="easyui-textbox" id="description" style="width: 100%; height: 46px;"
                                  data-options="required:true"></textarea>

                    </div>



                </td>
            </tr>
        </table>
        <input type="hidden" name="id" id="id_edit">
        <input type="hidden" name="userid" id="userid" value=<?php echo ($_SESSION['uid']); ?>>
        <input type="hidden" name="author" id="author" value=<?php echo ($_SESSION['uname']); ?>>
        <input type="hidden" name="nickname" id="nickname" value=<?php echo ($_SESSION['unickname']); ?>>
    </form>
</div>
<div id="dlg-chuli">

    <a href="#"  class="easyui-linkbutton" data-options="iconCls:'icon-ok'"
       onclick="bianjizj()">确认</a>
    <a href="#"  class="easyui-linkbutton" onclick='clearzjForm()'
       data-options="iconCls:'icon-standard-coins-delete',plain:true">清空</a>
    <a href="#" class="easyui-linkbutton"
       data-options="iconCls:'icon-cancel'"
       onclick="javascript:$('#edit_zj').dialog('close')">取消</a>
</div>

<script>

    $(function(){
        // $('#cj_add').combobox('select', '<?php echo ($cj); ?>');
    })

    function bianjizj(){
        var row = $('#zj_dg').datagrid("getSelected");
        $('#edit_zj_form').form('submit', {

            url :APP+ '/Home/Zhijia/edit',
            onSubmit: function(param){
                param.id = row.id;
            },
            success : function(data) {
                data = $.parseJSON(data);
                // console.log(data)
                if(data.status==1){
                    $('#edit_zl_form').form('clear');
                    $.messager.confirm('确认',data.msg+'是否要关闭编辑界面',function(r){
                        if (r){
                            $('#edit_zj').dialog('close');
                            $("#zj_dg").datagrid("reload");
                        }
                    });
                }else{
                    $.messager.alert('错误', data.msg, 'info');
                }

            }
        });
    }
function clearzjForm(){
    $.messager.confirm('确认','您确认想要清空支架吗？',function(r){
        if (r){
            $('#edit_zj_form').form('clear');
        }
    });
}

</script>


<!---->
<div id="showpic" class="easyui-dialog" style="width:650px;height:550px;padding:2px;overflow:hidden;" title="&nbsp;&nbsp;显示图片" data-options="iconCls:'icon-standard-folder-page',buttons:'#dlg-view',closed:true,resizable:true,modal:true,closable:true">
	<div id="pic_content" style="width:100%;height:100%;text-align:center;vertical-align: center"></div>
</div>



<div id="dlg-view">
	<div class="tool_tip">
		单击右键以保存图片！！

	</div>

	<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="javascript:$('#showpic').dialog('close')">取消</a>
</div>

// <script>
// 	$('#pic_content').smartZoom({
// 					'containerClass' : 'zoomableContainer'
// 				}); 
// </script>


<!---->




<style>
.detailtb td{
		/*background-color: rgba(133, 134, 136, 0.14);*/
		border: 1px solid #ccc;

	}
	.ditTitle{
		width:60px;font-weight:bold;color:#0E2D51;
		background-color: #F3F3F3;
	
	}
	.hfs{
		text-align: center;
		font-weight: bold;
		padding: 5px 0;
		color:#0E2D51;
		background-color: #F4F4F4
	}
	.hfr{
		font-weight: bold;
		padding-left:5px; 
	}
	.hfnr{
		padding:5px 2px 5px 15px; 
	}
	/*细节栏中的图片缩略图*/
	.picsl{
		width: 40px;
		padding:0 5px;
	}
	.picsl:hover{
		border:solid 1px #95B8E7;
		width: 35px;
		cursor: hand;
	}
	.pics2{
		max-width: 150px;
		max-height: 90px;
		padding:0 5px;

	}
</style>
<!-- 图片缩放穿件 -->
<script type="text/javascript">
    function showpic(url) {
        im = document.createElement('img');
        im.src=url;

        var pic='<img src="'+url+'" alt="图片" style="max-height:500px;max-width:600px"/>';

        $('#showpic').window('open');

        $("#pic_content").html(pic);
    }

    function pic(tp,cla){
        var tp=escape2Html(tp.replace(/\\\//g,'/'));
        var tp=$.parseJSON(tp);
        var pics="";
        for(var pici in tp){
            pics='<img src="/solve/Public/'+tp[pici].savename+'" alt="'+tp[pici].name+'" onclick="showpic(\'/solve/Public/'+tp[pici].savename+'\')" class="'+cla+'">'+pics;
        }
        return pics;
    }
    $('#zj_dg').datagrid({
        url: APP + '/Home/Zhijia/read',
        // toolbar: '#tool',
        pagination: true,
        fit: true,
        width: function () {
            return document.body.clientWidth * 0.9
        },
        nowrap: true,//
        collapsible: true,
        fitColumns: false,
        autoRowHeight: false,
        striped: true,//交替行
        singleSelect: true,//只允许选择一行
        rownumbers: true,
        border: false,
        sortName: 'id',
        sortOrder: 'desc',//倒序排列
        remoteSort: false,
        pageSize: 30,
        method: "post",
        pageList: [10, 15, 30, 40, 50, 100, 200, 500, 1000],
        columns: [[
            {
                field: 'id',
                checkbox: true
            },{
            field: 'th',
            title: '图号',
            width: 150
        }
            , {
                field: 'mc',
                title: '名称',
                width: 150
            }, {
                field: 'fl',
                title: '标签',
                width: 150
            },
            {
                field: 'description',
                title: '说明',
                width: 300,
                align: 'left'
            }
            ,
            {
                field: 'lb',
                title: '类别',
                width: 120,
                align: 'left'
            }


        ]],
        rowStyler: function(index,row){
            // if (row.status=='待处理'){
            //     return 'background-color:#FFCCCC;color:#304c80;';
            //     // rowStyle是一个已经定义了的ClassName(类名)
            // }else{
            //     return 'background-color:#CCFFCC;color:#304c80;';
            // }
        },
        onClickRow:function(rowIndex, rowData){
            $('#info_form').form('load',rowData);
            // $('#wtcl').form('load',rowData);
            // $('#wtyz').form('load',rowData);
            //
            // $('#cxxx').form('load',rowData);
            // 添加图片显示
            $('#tzshows').html();
            $('#zpshows').html();
            cla='zlpic';

            var tp=rowData.tzs;
            var zp=rowData.zps;
            if(tp!=null){
                tp=escape2Html(tp.replace(/\\\//g,'/'));
                tp=$.parseJSON(tp);
                var pics="";
                for(var pici in tp){
                    pics='<img src="/solve/Public/'+tp[pici].savename+'" alt="'+tp[pici].name+'" onclick="showpic(\'/solve/Public/'+tp[pici].savename+'\')" class="'+cla+'">'+pics;
                }
                $('#tzshows').html(pics);
            }else{
                $('#tzshows').html('');
            }
            if(zp!=null){
                zp=escape2Html(zp.replace(/\\\//g,'/'));
                zp=$.parseJSON(zp);
                var pics="";
                for(var pici in zp){
                    pics='<img src="/solve/Public/'+zp[pici].savename+'" alt="'+zp[pici].name+'" onclick="showpic(\'/solve/Public/'+zp[pici].savename+'\')" class="'+cla+'">'+pics;
                }
                $('#zpshows').html(pics);
            }else{
                $('#zpshows').html('');
            }

// 处理图片显示
            $('#cltp').html();
            cla='zlpic';
            var tp=rowData.chuli_pics;
            if(tp!=null){
                tp=escape2Html(tp.replace(/\\\//g,'/'));
                tp=$.parseJSON(tp);
                var pics="";
                for(var pici in tp){
                    pics='<img src="/solve/Public/'+tp[pici].savename+'" alt="'+tp[pici].name+'" onclick="showpic(\'/solve/Public/'+tp[pici].savename+'\')" class="'+cla+'">'+pics;
                }
                $('#cltp').html(pics);
            }else{
                $('#cltp').html('');
            }


        },
        onDblClickRow: function (rowIndex, rowData) {
            // console.log(rowData);

            //
            // if (rowData) {
            //     $("#view").dialog("open").dialog('setTitle', '&nbsp;&nbsp;查看记录');
            //     view();
            //
            //
            // } else {
            //     console.log("没有数据！");
            // }
        },

        onLoadSuccess: function () {
            // $(".grid_pic").linkbutton({
            // 	text : '&nbsp;&nbsp;显示',
            // 	plain : true,
            // 	iconCls : 'icon-standard-picture'
            // });
            $('#zj_dg').datagrid('doCellTip', {cls: {'background-color': '#EAF1FF'}, delay: 600});
        }
    });




//格式化图片下载
function pic(tp,cla){
var tp=escape2Html(tp.replace(/\\\//g,'/'));
var tp=$.parseJSON(tp);
var pics="";
for(var pici in tp){
		pics='<img src="/solve/Public/'+tp[pici].savename+'" alt="'+tp[pici].name+'" onclick="showpic(\'/solve/Public/'+tp[pici].savename+'\')" class="'+cla+'">'+pics;	
	}
	return pics;
}

function escape2Html(str) {
 var arrEntities={'lt':'<','gt':'>','nbsp':' ','amp':'&','quot':'"'};
 return str.replace(/&(lt|gt|nbsp|amp|quot);/ig,function(all,t){return arrEntities[t];});
}
// 格式化回复
function hfFormat(str){
	if(str.length!=0){
	var data=$.parseJSON(str);

	var huifu="";
	for(var item in data){
		huifu='<span class="hfr">'+data[item].uname+'：['+data[item].time+']</span><div class="hfnr">'+data[item].huifu+'</div>'+huifu;	
	}
	huifu='<div class="hfs">回复</div>'+huifu;
}else{
	huifu="";
}
	return huifu;		
}
// 格式化回复
function hfFormat2(str){
	if(str.length!=0){
	var data=$.parseJSON(str);

	var huifu="";
	for(var item in data){
		huifu='<span class="hfr">'+data[item].uname+'：['+data[item].time+']</span><div class="hfnr">'+data[item].huifu+'</div>'+huifu;	
	}
	// huifu='<div class="hfs">回复</div>'+huifu;
}else{
	huifu="";
}
	return huifu;		
}
function banci(bc){
	var banci1="";

	if(bc=='day'){
		 banci1="白班";
		}else{
			 banci1="夜班";
		}
	
		return banci1;
}
// 格式化类别
function leibie(val){
	var leibie="";
	switch(val)
	{
	case "lbj":
	  leibie="零部件";
	  break;
	 case "sj":
	  leibie="设计";
	  break;
	case "gy":
	  leibie="工艺";
	  break;
	case "zp":
	  leibie="装配";
	  break;
	  case "bzj":
	  leibie="标准件";
	  break;


	default:
	   leibie="其他";
	}
		return leibie;
}
// 格式化车型平台
// //   <option value="F3000">F3000</option>
//                     <option value="M3000">M3000</option>
//                     <option value="X3000">X3000</option>
//                     <option value="STR">奥龙</option>
//                     <option value="PZ">偏置</option>
//                     <option value="KY">矿用</option>
//                     <option value="QT">其他</option>
function pt(val){
	var leibie="";
	switch(val)
	{
	case "F3000":
	  leibie="F3000	";
	  break;
	  	case "M3000":
	  leibie="M3000";
	  break;
	 case "X3000":
	  leibie="X3000";
	  break;
	case "STR":
	  leibie="奥龙";
	  break;
	case "PZ":
	  leibie="偏置";
	  break;
	  case "KY":
	  leibie="矿用";
	  break;
	  case "QT":
	  leibie="其他";
	  break;
  case "JUN":
	  leibie="军车";
	  break;

	default:
	   leibie="其他";
	}
		return leibie;
}
// 格式化车辆类型
 // <option value="1">载货车</option>
 //                    <option value="2">越野车</option>
 //                    <option value="3">自卸车</option>
 //                    <option value="4">牵引车</option>
 //                    <option value="5">专用车</option>
 //                    <option value="6">其他</option>
function cx(val){
	var leibie="";
	switch(val)
	{
	case "1":
	  leibie="载货车";
	  break;
	case "2":
	  leibie="越野车";
	  break;
	case "3":
	  leibie="自卸车";
	  break;
	case "4":
	  leibie="牵引车";
	  break;
	case "5":
	  leibie="专用车";
	  break;
	  case "6":
	  leibie="其他";
	  break;

	default:
	   leibie="其他";
	}
		return leibie;
}
// 格式化车间
// <option value=""></option>
//                     <option value="zp1">装配一车间</option>
//                     <option value="zp2">装配二车间</option>
//                     <option value="sz1">试制一车间</option>
//                     <option value="sz2">试制二车间</option>
//                     <option value="ts">调试车间</option>
//                     <option value="yl">预留区</option>
function cj(val){
	var leibie="";
	switch(val)
	{
	case "zp1":
	  leibie="装配一车间";
	  break;
	case "zp2":
	  leibie="装配二车间";
	  break;
	case "sz1":
	  leibie="试制一车间";
	  break;
	case "sz2":
	  leibie="试制二车间";
	  break;
	case "ts":
	  leibie="调试车间";
	  break;
	  	case "ns":
	  leibie="内饰车间";
	  break;
	  case "yl":
	  leibie="预留区";
	  break;

	default:
	   leibie="其他";
	}
		return leibie;
}
	//对Date的扩展，将 Date 转化为指定格式的String 
	//月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符， 
	//年(y)可以用 1-4 个占位符，毫秒(S)只能用 1 个占位符(是 1-3 位的数字) 
	//例子： 
	//(new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 
	//(new Date()).Format("yyyy-M-d h:m:s.S")      ==> 2006-7-2 8:9:4.18 
	Date.prototype.Format = function(fmt) { //author: meizz 
		var o = {
			"M+" : this.getMonth() + 1, //月份 
			"d+" : this.getDate(), //日 
			"h+" : this.getHours(), //小时 
			"m+" : this.getMinutes(), //分 
			"s+" : this.getSeconds(), //秒 
			"q+" : Math.floor((this.getMonth() + 3) / 3), //季度 
			"S" : this.getMilliseconds()
		//毫秒 
		};
		if (/(y+)/.test(fmt))
			fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "")
					.substr(4 - RegExp.$1.length));
		for ( var k in o)
			if (new RegExp("(" + k + ")").test(fmt))
				fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k])
						: (("00" + o[k]).substr(("" + o[k]).length)));
		return fmt;
	}
	//今天、昨天 白班 夜班
	//打开添加窗口

	function showupload() {
		$('#showupload').window('open'); // open a window 	
	}



//显示当前日期
formatterDate = function (date) {
var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate();
var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0"
+ (date.getMonth() + 1);
var hor = date.getHours();
var min = date.getMinutes();
var sec = date.getSeconds();
return date.getFullYear() + '-' + month + '-' + day+" "+hor+":"+min+":"+sec;
};


function showpic(url) {
	im = document.createElement('img');
	im.src=url;

var pic='<img src="'+url+'" alt="图片" style="max-height:500px;max-width:600px"/>';

 $('#showpic').window('open');
	
$("#pic_content").html(pic);	
}



	function reloadzj() {
		$('#zj_dg').datagrid('reload', {
		    cx: '' 
		});
	}
	function add() {
 // $("#addok").linkbutton("disable");
		$('#add_form').form('submit', {

			url : '/solve/index.php/Home/Quality/add_quality',

			success : function(data) {
				$("#dg").datagrid("reload");

				$.messager.alert('添加项目', data, 'info');
				$('#add').dialog('close')

			}
		});
	}

	//删除		
	function delezj() {
		var row = $('#zj_dg').datagrid("getSelected");
		var group_id="<?php echo ($_SESSION['group_id']); ?>".split(",");
		


			if (row) {
                if (row.userid == "<?php echo ($_SESSION[ 'uid']); ?>" || $.inArray("1", group_id)!=-1 || $.inArray("20", group_id)!=-1)  {

				$.messager.confirm('确认', '您确定要删除此项目吗?', function(r) {
					if (r) {
						$.post(APP+'/Home/Zhijia/del', {
							id : row.id
						}, function(data) {

                            if (data.status==1) {
								$.messager.alert('删除项目', data.msg, 'info');
								$("#zj_dg").datagrid("reload");
                                $('#info_form').form('clear');

                                $('#tzshows').html('');
                                $('#zpshows').html('');
							} else {
								$.messager.show({ // show error message  
									title : '错误',
									msg : result.errorMsg
								});

							}
						}, 'json');
					}
				});

                } else {

                    $.messager.alert("无法删除", "此信息非您创建，无法删除！", "info");
                }
			} else {
				$.messager.alert("请选择", "请选择要删除的项目！", "info");
			}



	}




	function page() {
		return $('#dg').datagrid('options').pageNumber;
	}
	function pagesize() {
		return $('#dg').datagrid('options').pagesize;
	}
	function daochu() {

            window.location.href=APP+'/Home/Zhijia/dabao/';

        //
        //
        //
		// var grid = $('#zl_dg');
		// var options = grid.datagrid('getPager').data("pagination").options;
		// var pageNumber = options.pageNumber;
		// var pageSize=options.pageSize;

		// window.location.href=APP+'/Home/Zhiliang/out/page/'+pageNumber+'/pagesize/'+pageSize;
	}

</script>